
/**
 * 
 */package com.yang.webhook.common.utils;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

 public class SessionUtil {

     protected static HttpServletRequest getRequest() {
         return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
     }

     protected ServletContext getServletContext(){
         HttpServletRequest request = getRequest();
         if (request != null){
             return request.getSession().getServletContext();
         }
         return null;
     }
     
 }
